<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet"/>
    <link rel="stylesheet" th:href="@{/css/Site.css}" href="css/Site.css"/>
    <link rel="stylesheet" th:href="@{/css/zy.all.css}" href="css/zy.all.css"/>
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}" href="css/font-awesome.min.css"/>
    <link rel="stylesheet" th:href="@{/css/amazeui.min.css}" href="css/amazeui.min.css"/>
    <link rel="stylesheet" th:href="@{/css/admin.css}" href="css/admin.css"/>
    <!--		在标题栏的左侧显示图标 href:图标地址-->
    <link rel="icon" href="images/logo/favicon.ico" type="image/x-icon">
    <!--		在收藏夹里面显示图标 href:图标地址-->
    <link rel="shortcut icon" href="images/logo/favicon.ico" type="image/x-icon">
</head>
<body>
<div class="dvcontent">

    <div>
        <!--tab start-->
        <div class="tabs">
            <div class="hd">
                <ul>
                    <li class="on" style="box-sizing: initial;-webkit-box-sizing: initial;">查看用户</li>
                    <li class="" style="box-sizing: initial;-webkit-box-sizing: initial;">添加用户</li>
                </ul>
            </div>
            <div class="bd">
                <ul style="display: block;padding: 20px;">
                    <li>
                        <!--分页显示角色信息 start-->
                        <div id="dv1">
                            <table class="table" id="tbRecord">
                                <thead>
                                <tr>
                                    <th>编号</th>
                                    <th>用户名</th>
                                    <th>姓名</th>
                                    <th>性别</th>
                                    <th>手机</th>
                                    <th>邮箱</th>
                                    <th>状态</th>
                                    <th>冻结</th>
                                    <th>修改</th>
                                    <th>详细</th>
                                    <th>删除</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr th:each="user:${pageUtils.data}">
                                    <td th:text="${user.id}"></td>
                                    <td th:text="${user.uno}"></td>
                                    <td th:text="${user.uname}"></td>
                                    <td th:text="${user.usex}==0?'女':'男'"></td>
                                    <td th:text="${user.uphone}"></td>
                                    <td th:text="${user.uemail}"></td>
                                    <td th:text="${user.ustate}==0?'启用':'禁用'"></td>
                                    <td class="edit">
                                        <button th:onclick="|btn_edit(${user.id},${user.ustate})|"><i
                                                class="icon-adjust bigger-120"></i>[(${user.ustate}==0?'禁用':'启用')]
                                        </button>
                                    </td>
                                    <td class="edit">
                                        <button th:onclick="|window.location.href='user_editUserById?id=${user.id}'|"><i
                                                class="icon-edit bigger-120"></i>编辑
                                        </button>
                                    </td>
                                    <td class="edit">
                                        <button th:onclick="|window.location.href='user_getById?id=${user.id}'|"><i
                                                class="icon-adn bigger-120"></i>详情
                                        </button>
                                    </td>
                                    <td class="delete">
                                        <button th:onclick="|btn_delete(${user.id})|"><i
                                                class="icon-trash bigger-120"></i>删除
                                        </button>
                                    </td>
                                </tr>

                                </tbody>
                            </table>
                            <center>
                                <a href="type_page?pageIndex=1">首页</a>
                                <a th:if="${pageUtils.pageIndex>1}"
                                   th:href="|user_page?pageIndex=${pageUtils.pageIndex-1}|">上一页</a>
                                <a th:each="num:${pageUtils.numbers}" th:class="${pageUtils.pageIndex==num}? a"
                                   th:text="|${num} |"></a>

                                <a th:if="${pageUtils.pageIndex<pageUtils.pageCount}"
                                   th:href="|user_page?pageIndex=${pageUtils.pageIndex+1}|">下一页</a>
                                <a th:href="|user_page?pageIndex=${pageUtils.pageCount}|">尾页</a>
                                [<span th:text="${pageUtils.pageIndex}"></span>/<span
                                    th:text="${pageUtils.pageCount}"></span>]
                                共<span th:text="${pageUtils.totalCount}"></span>条
                            </center>
                        </div>
                        <!--分页显示角色信息 end-->
                    </li>
                </ul>
                <ul class="theme-popbod dform" style="display: none;">
                    <div class="am-cf admin-main" style="padding-top: 0px;">
                        <!-- content start -->

                        <div class="am-cf admin-main" style="padding-top: 0px;">
                            <!-- content start -->
                            <div class="admin-content">
                                <div class="admin-content-body">

                                    <div class="am-g">
                                        <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">

                                        </div>
                                        <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4"
                                             style="padding-top: 30px;">
                                            <form class="am-form am-form-horizontal"
                                                  action="user_add" method="post" enctype="multipart/form-data">

                                                <div class="am-form-group">
                                                    <label for="user-no" class="am-u-sm-3 am-form-label">
                                                        用户名: </label>
                                                    <div class="am-u-sm-9">
                                                        <input type="text" id="user-no" required
                                                               placeholder="用户名" name="uno">
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="user-name" class="am-u-sm-3 am-form-label">
                                                        姓名:</label>
                                                    <div class="am-u-sm-9">
                                                        <input type="text" id="user-name" required
                                                               placeholder="姓名" name="uname">
                                                    </div>
                                                </div>

                                                <div class="am-form-group">
                                                    <label for="user-pwd" class="am-u-sm-3 am-form-label">
                                                        密码:</label>
                                                    <div class="am-u-sm-9">
                                                        <input type="password" id="user-pwd" required
                                                               placeholder="密码" name="upass">
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="image" class="am-u-sm-3 am-form-label">
                                                        商品图片</label>
                                                    <div class="am-u-sm-9">
                                                        <input type="file" id="image" required placeholder="用户头像"
                                                               name="file">
                                                        <small>...</small>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="man" class="am-u-sm-3 am-form-label">
                                                        性别:</label>
                                                    <div class="am-u-sm-9" style="line-height: 30px;">
                                                        <input id="man" type="radio" checked="checked" name="usex"
                                                               value="1"/>男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                        <input id="woman" type="radio" name="usex" value="0"/>女
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="user-phone" class="am-u-sm-3 am-form-label">
                                                        联系电话: </label>
                                                    <div class="am-u-sm-9">
                                                        <input type="tel" id="user-phone" required
                                                               placeholder="请输入联系电话" name="uphone"/>
                                                        <small>联系电话...</small>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="user-place" class="am-u-sm-3 am-form-label">
                                                        家庭住址:</label>
                                                    <div class="am-u-sm-9">
                                                        <input type="text" id="user-place" required
                                                               placeholder="请输入家庭住址"
                                                               name="uplace"/> <small>家庭住址...</small>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="user-email" class="am-u-sm-3 am-form-label">
                                                        电子邮件: </label>
                                                    <div class="am-u-sm-9">
                                                        <input type="email" id="user-email" required
                                                               placeholder="输入你的电子邮件" name="uemail"/>
                                                        <small>邮箱你懂得...</small>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <label for="user-intro" class="am-u-sm-3 am-form-label">
                                                        备注:</label>
                                                    <div class="am-u-sm-9">
									<textarea class="" rows="5" id="user-intro" name="uintrog"
                                              placeholder="输入备注"></textarea>
                                                        <small>250字以内...</small>
                                                    </div>
                                                </div>
                                                <div class="am-form-group">
                                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                                        <input type="submit" class="am-btn am-btn-success"
                                                               value="添加用户"/>
                                                    </div>
                                                </div>
                                            </form>

                                        </div>
                                    </div>
                                </div>

                            </div>
                            <!-- content end -->
                        </div>
                        <!--添加角色 end-->
                        <!--tab end-->

                    </div>
                    <div>


                        <script src="js/jquery-1.7.2.min.js" type="text/javascript"></script>
                        <script src="js/plugs/Jqueryplugs.js" type="text/javascript"></script>
                        <script src="js/_layout.js"></script>
                        <script src="js/plugs/jquery.SuperSlide.source.js"></script>
                        <script>
                            var num = 1;
                            $(function () {

                                $(".tabs").slide({trigger: "click"});

                            });

                            //账号启用/禁用
                            var btn_edit = function (id, ustate) {
                                var state_name = (ustate == "0") ? "禁用" : "启用";
                                $.jq_Confirm({
                                    message: "您确定要" + state_name + "吗?",
                                    btnOkClick: function () {
                                        $.ajax({
                                            type: "post",
                                            url: "user_state",
                                            data: {id: id, ustate: ustate},
                                            success: function (result) {
                                                if (result.code == 200) {
                                                    $.jq_Alert({
                                                        message: result.message,
                                                        btnOkClick: function () {
                                                            location.href = "user_page";
                                                        }
                                                    });
                                                } else {
                                                    $.jq_Alert({
                                                        message: result.message,
                                                        btnOkClick: function () {
                                                            location.href = "user_page";
                                                        }
                                                    });
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                            //删除
                            var btn_delete = function (id) {
                                $.jq_Confirm({
                                    message: "您确定要删除吗?",
                                    btnOkClick: function () {
                                        $.ajax({
                                            type: "post",
                                            url: "user_delete",
                                            data: {id: id},
                                            success: function (result) {
                                                if (result.code == 200) {
                                                    $.jq_Alert({
                                                        message: result.message,
                                                        btnOkClick: function () {
                                                            location.href = "user_page";
                                                        }
                                                    });
                                                } else {
                                                    $.jq_Alert({
                                                        message: result.message,
                                                        btnOkClick: function () {
                                                            location.href = "user_page";
                                                        }
                                                    });
                                                }
                                            }
                                        });
                                    }
                                });
                            }
                        </script>

                    </div>
				</ul>
			</div>
		</div>
	</div>
</div>
</body>

</html>